import { defineConfig, loadEnv } from 'vite'
import path from 'path'
import react from '@vitejs/plugin-react'

export default defineConfig(({ mode }) =>{
  const env = loadEnv(mode, path.resolve(process.cwd(), 'env'), 'VITE_APP')
  return {
    base: env.REACT_APP_PUBLIC_PATH,
    plugins: [react()],
    define: {
      'process.env': env
    }
  }
})
